-
Couldn't load subscription status.
- Fork 13.9k
Use a distinct ToString implementation for u128 and i128
#142294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use a distinct ToString implementation for u128 and i128
#142294
Conversation
|
rustbot has assigned @workingjubilee. Use |
|
☔ The latest upstream changes (presumably #136594) made this pull request unmergeable. Please resolve the merge conflicts. |
b5b6654 to
53dc659
Compare
|
Fixed merge conflicts. |
ToString implementation on u128 and i128ToString implementation for u128 and i128
|
Having done code review of things that use Rust's |
|
Noted, thanks for the title update then. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you've tested locally, is there any measurable perf/size impact here?
53dc659 to
9b09948
Compare
|
@tgross35 I added the comparison in the first comment with the code I use to get the performance comparison. |
|
Thanks! I don't think this needs a pre-merge perf run since we didn't see any perf-visible impact in #136594, but it wouldn't hurt to get one after so @bors r+ rollup=never Fyi @pascaldekloe since you did the last round of perf boosts for these methods |
|
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 255aa22 (parent) -> 5b74275 (this PR) Test differencesShow 26 test diffsStage 1
Additionally, 24 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 5b74275f89b6041bf2e9dc2abcf332e206d4cfca --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (5b74275): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -1.9%, secondary -2.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 4.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 692.261s -> 692.705s (0.06%) |
…n-128-integers, r=tgross35 Use a distinct `ToString` implementation for `u128` and `i128` Part of rust-lang#135543. Follow-up of rust-lang#136264. When working on rust-lang#142098, I realized that `i128` and `u128` could also benefit from a distinct `ToString` implementation so here it. The last commit is just me realizing that I forgot to add the format tests for `usize` and `isize`. Here is the bench comparison: | bench name | last nightly | with this PR | diff | |-|-|-|-| | bench_i128 | 29.25 ns/iter (+/- 0.66) | 17.52 ns/iter (+/- 0.7) | -40.1% | | bench_u128 | 34.06 ns/iter (+/- 0.21) | 16.1 ns/iter (+/- 0.6) | -52.7% | I used this code to test: ```rust #![feature(test)] extern crate test; use test::{Bencher, black_box}; #[inline(always)] fn convert_to_string<T: ToString>(n: T) -> String { n.to_string() } macro_rules! decl_benches { ($($name:ident: $ty:ident,)+) => { $( #[bench] fn $name(c: &mut Bencher) { c.iter(|| convert_to_string(black_box({ let nb: $ty = 20; nb }))); } )+ } } decl_benches! { bench_u128: u128, bench_i128: i128, } ```
Part of #135543.
Follow-up of #136264.
When working on #142098, I realized that
i128andu128could also benefit from a distinctToStringimplementation so here it.The last commit is just me realizing that I forgot to add the format tests for
usizeandisize.Here is the bench comparison:
I used this code to test: